﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Xml;
using System.Text;

public partial class DMS : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow row = GridView1.SelectedRow;
        int value = Int32.Parse(row.Cells[1].Text);
        Response.Redirect("~/Incident.aspx?ID=" + value);

    }

    protected void search_btn_Click(object sender, EventArgs e)
    {
        nf_label.Visible = false;
        string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|Database.accdb;Persist Security Info=True";
        string selectState = "Select * from Incidents where (Incident_ID = "+ Int32.Parse(search_TB.Text)+")";

        DataSet userDS = new DataSet();
        OleDbConnection db_conn = new OleDbConnection(connString);
        db_conn.Open();
        OleDbDataAdapter db_dataAdapter = new OleDbDataAdapter(selectState, db_conn);
        db_dataAdapter.Fill(userDS);
        db_conn.Close();
        if (userDS != null)
        {
            if (userDS.Tables[0].Rows.Count > 0)
            {

                Response.Redirect("Incident.aspx?ID=" + search_TB.Text);
            }
            else
            {
                nf_label.Visible = true;
            }
        }



    }
}